package com.shu.jdk;

import com.google.common.collect.Lists;

import java.util.ArrayList;

/**
 * @author ssm
 * @version V1.0
 * @description:
 * @date 2021/8/19 21:23
 */

public class ValRef {

    public static void main(String[] args) {
        String num1 = "10";
        String num2 = "20";

        ArrayList<String> strings = Lists.newArrayList(num1, num2);
        swap(strings);

        System.out.println("num1 = " + strings.get(0));
        System.out.println("num2 = " + strings.get(1));
    }

    public static void swap(ArrayList<String> strings) {
        String temp = strings.get(0);
        strings.set(0, strings.get(1));
        strings.set(1, temp);
    }
}
